<?php
/* Load the class */
require_once('DropboxClient.php');
/* Create new instance with your consumer token and secret */
$dc=new DropboxClient("your_consumer_token","your_consumer_secret");
/* Set the users access token and secret */
$dc->setToken("user_token","user_secret");

/*
 API actions
 Mostly strictly implemented from web documentation
*/
/* Get account info of the user */
$data=$dc->accountInfo();

/*
 This is how to prepare a file for upload
 it is an associative array with 3 items:
 filname, content-type, content
*/
$file=array("filename"=>"newFile.txt",
	    "content-type"=>"text/plain",
	    "content"=>"Howdy!");
/* Upload a file */
$data=$dc->files('/',$file);
/* Download a file */
$data=$dc->files('/newFile.txt');

/* Get metadata of a file or a directory */
$data=$dc->metadata('/','true');
$data=$dc->metadata('/newFile.txt');

/* File operation copy,move,delete,create_folder */
$data=$dc->fileops('create_folder','/newFolder');
$data=$dc->fileops('copy','/newFile.txt','/newFolder/newFile_copy.txt');
$data=$dc->fileops('move','/newFile.txt','/newFolder/newFile.txt');
$data=$dc->fileops('delete','/newFolder/newFile_copy.txt');

/* Get thumbnails */
$data=$dc->thumbnails('/somePicture.jpg','small');

/* And liks for preview (currently not working properly) */
$data=$dc->links('/somePicture.jpg');

/* Set the root for actions later on */
$dc->setRoot('dropbox');
$data=$dc->metadata("/",'true');

?>